@extends('layouts.app')

@section('content')
    {{--小区图纸--}}
    <div class="mask-full"></div>
    <div class="mask-pop">
        <el-row>
            <el-row class="community-thumb" :style="communityStyle">
                <el-col v-for="(item, index) in buildingList"
                        :key="index"
                        class="community-building">
                    <el-link @click="showBuildingDetail(item)"
                             :type="item.id ? 'primary' : 'info'">
                        <span v-if="item.id" style="color:#f00;"> @{{ item.build_num }}</span>
                        <span v-else>&nbsp;</span>
                    </el-link>
                </el-col>
            </el-row>
        </el-row>
    </div>
    <el-dialog
            title="楼栋信息"
            :visible.sync="dialog.isShow"
            width="90%">
        <el-form label-width="70px">
            <el-form-item label="编号" required>
                <el-input v-model="buildingDetail.build_num"></el-input>
            </el-form-item>
            <el-form-item label="名称" required>
                <el-input v-model="buildingDetail.name"></el-input>
            </el-form-item>
            <el-form-item label="楼层数" required>
                <el-input-number v-model="buildingDetail.floor_num"
                                 :min="0"
                                 :step="1"></el-input-number>
            </el-form-item>
            <el-form-item label="图集">
                <el-upload
                        name="file"
                        multiple
                        :data="{_token: '{{csrf_token()}}'}"
                        action="/community/upload"
                        :on-success="function(r, f, l){return fileSuccess(r, f, l, 'pics')}"
                        :on-preview="filePreview"
                        :on-remove="function(f, l){return fileRemove(f, l, 'pics')}"
                        :file-list="buildingDetail.pics"
                        :on-exceed="fileExceed"
                        list-type="picture">
                    <el-button size="small" type="primary">点击上传</el-button>
                    <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过2M</div>
                </el-upload>
            </el-form-item>
            <el-form-item label="描述">
                <el-input v-model="buildingDetail.description"></el-input>
            </el-form-item>
            <el-form-item label="备注">
                <el-input v-model="buildingDetail.remarks"></el-input>
            </el-form-item>
        </el-form>
        <el-row style="text-align:center;">
            <el-button type="primary"
                       @click="buildingSave"
                       :disabled="dialog.disabled">保存</el-button>
            <el-button type="primary"
                       v-if="buildingDetail.id"
                       @click="goBuildingDetail(buildingDetail)">进入楼栋</el-button>
        </el-row>
    </el-dialog>
@endsection

@section('js')
    <script src="/js/community/detail.js?v=20191207"></script>
@endsection